<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .wrapper {
      width: 200px;
      height: 200px;
      background-color: green;
    }

    .box {
      width: 100px;
      height: 100px;
      background-color: red;
    }

    .drag-box {
      position: absolute;
      left: 20px;
      top: 210px;
      width: 200px;
      height: 200px;
      background-color: red;
      line-height: 200px;
      text-align: center;
      cursor: pointer;
    }
  </style>
</head>

<body>
  <div class="wrapper">
    <div class="box"></div>
  </div>
  <div class="drag-box">drag-box</div>
  <script src="./事件.js"></script>
  <script>
    const wrapper = document.getElementsByClassName('wrapper')[0]
    const box = document.getElementsByClassName('box')[0]
    wrapper.addEventListener('click', function () {
      console.log('wrapper')
    }, false)
    box.addEventListener('click', function () {
      console.log('box')
    }, false)

    wrapper.addEventListener('click', function () {
      console.log('wrapperCapture')
    }, true)
    box.addEventListener('click', function () {
      console.log('boxCapture')
    }, true)
  </script>
  <script>
    const dragBox = document.getElementsByClassName('drag-box')[0]
    drag(dragBox)
  </script>
</body>

</html>